<?php
//require './admin/sever_newstypes.php';
require './api/sever_edit.php';
//var_dump($type);
//?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>修改信息</title>
    <link rel="stylesheet" href="./layui/css/layui.css">
    <style>
        table img{
            width: 60px;
            height: 60px;
        }

        .w-e-toolbar {

            z-index: 2 !important;
        }

        .w-e-text-container{
            z-index: 1 !important;
        }
        body{
            margin: 0px;
            width: 375px;
            height: 61px;
        }
        #img1{
            width: 375px;
            height: 61px;
        }
        #return{
            width: 21px;
            height: 40px;
        }
        #mine{
            position: absolute;
            top: 20px;
            left: 140px;
            color: white;
            font-family: 方正粗黑宋简体;
        }
    </style>
</head>
<body>
<div style="position:relative;height: 61px">
    <img id="img1" src="./img/nearby/img1.png">
    <div style="position:absolute; left:10px; top:8px;">
        <img id="return" src="./img/nearby/return.png" onclick="history.go(-1)">
    </div>
    <div id="mine">
        <h2>修改信息</h2>
    </div>
    <div style="padding: 15px">
        <form class="layui-form" enctype="multipart/form-data" action="./api/sever_doedit.php" method="post">
            <input type="hidden" value="<?=$item['id']?>" name="id">
            <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline">
                    <input value="<?=$item['username']?>" type="text" name="username" required  lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">余额</label>
                <div class="layui-input-inline">
                    <input value="<?=$item['money']?>" type="text" name="money" required  lay-verify="required" placeholder="请输入余额" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">卡号</label>
                <div class="layui-input-inline">
                    <input value="<?=$item['card_id']?>" type="text" name="card_id" required  lay-verify="required" placeholder="请输入卡号" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">详情</label>
                <div class="layui-input-inline">
                    <input value="<?=$item['information']?>" type="text" name="information" required  lay-verify="required" placeholder="请输入详情" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">学校</label>
                <div class="layui-input-inline">
                    <input value="<?=$item['school']?>" type="text" name="school" required  lay-verify="required" placeholder="请输入学校" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button onclick="addContent()" class="layui-btn" lay-submit lay-filter="formDemo">确认</button>
                        <!--                            <button onclick="history.go(-1)"  class="layui-btn layui-btn-primary">返回</button>-->
                        <button onclick="history.go(-1)"  class="layui-btn layui-btn-primary">返回</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<script src="./api/app.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.12.4/jquery.js"></script>
<script src="./layui/layui.js"></script>
<script>
    //JavaScript代码区域
    function addContent(){
        var content=document.querySelector('input[name=content]')
        content.value=editor.txt.html();
    }

    layui.use(['element','form','upload','laydate'], function(){

        var element = layui.element;

        var upload = layui.upload;

        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#birthday' //指定元素
        })

        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: './api/upload.php' //上传接口
            ,field:'pic'
            ,done: function(res){
                //上传完毕回调
                console.log(res)
                path=res.data.path
                icon= document.getElementById('show_img');
                icon.setAttribute('src','./api/uploads/'+path);
                icon.style.display='inline-block';

                img=document.querySelector('input[name=pic]');
                img.value=path;
            }
            ,error: function(){
                //请求异常回调
                console.log(res)
            }
        });


    });



</script>
</html>
